<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>相关政策</title>
<%@ include file="/common/util.jsp"%>


<script type="text/javascript">
$(document).ready(function(){
	for ( var i = 1; i < 12; i++) {
        $("#id" + i).removeClass("current");
    }
    $("#id7").addClass("current");

});

	function checkFile(){
		var fileName = $("#uploadfile").val();
		if($.trim(fileName)==""){
			dialog_alert("文件名不能为空！");
			return;
		}
		
		//判断文件名是否已经存在
		$.ajax({
			type : "POST",
			contentType : "application/json",
			url : "checkFileName.shtml",
			data : fileName,
			dataType : "json",
			success: function(data){
				if(data.existFlag == true){
					dialog_alert("文件名已经存在！");
				}else{
					$("#uploadform").submit();
				}
			},
			error: function(){
				dialog_alert("文件上传失败！");
			}
		});
	}
	
</script>
</head>
<body class="main">
	<div class="-frame -style -luster" id="css_container">
		<!--首页框架页眉部分↓-->
		<%@ include file="/WEB-INF/pages/inc/header.jsp"%>
		<!--首页框架页眉部分↑-->

		<div class="content">
			<!-- Left导航菜单◎开始 -->
			<%@ include file="/WEB-INF/pages/inc/leftmenu.jsp"%>
			<!-- Left导航菜单◎结束 -->

			<div class="main-mid">
				<div class="pos"><img src="${cdnctx}/src/index/img/index.png"><a href="${cdnctx}/policyInit.shtml"><%=request.getSession().getAttribute("customername")%>_相关政策</a></div>
				<div class="css_contentDiv">
					<div class="searchDetailed  c-border-radius  b-box-shadow">
						<div id="showNodata">
							<font color="red">${msg}&nbsp;</font>
						</div>
							<c:if test="${roleid == 0}">
								  <form id="uploadform" action="${cdnctx}/fileUpload.shtml" method="post" enctype="multipart/form-data"> 
								  	<div style="padding-left: 15px;">
								  		<table><tr>
									        <td width="100px;"><lable class="search_text">上传文件名称：</lable></td>
									        <td width="180px;"><input id="uploadfile" type="file" name="fileUpload" class="search_input" /> </td> 
									        <td width="200px;"><input type="button" value="上&nbsp;传" class="search_btn" onclick="checkFile();" />  </td>
								        </tr></table>
								      </div> 
								  </form>
								  <br />
							</c:if>
						   <div class="divTable">
								<div style="height:99%;background-color:white;overflow: auto;">
									<table width="100%" class="list_table"  >
										<thead>
											<tr>
												<td width="5%">No.</td>
												<td>文件名称<span style="color: red;font-size: 14px; ">(点击链接下载)</span></td>
											</tr>
										</thead>
										<c:if test="${not empty(list) }">
										<c:forEach items="${list}" var="entity" varStatus="status">
											<tr>
												<td>${status.index + 1}</td>
												<td><a href="${cdnctx}/fileDownload.shtml?filename=${entity.fileName}">${entity.fileName}</a></td>
											</tr>
										</c:forEach>
										</c:if>
									</table>
								</div>
						</div>
              		</div>
				</div>
			</div>

		</div>

		<!--首页框架页尾部分↓-->
		<%@ include file="/WEB-INF/pages/inc/footer.jsp"%>
		<!--首页框架页尾部分↑-->
	</div>
</body>
</html>
